import Cookies from 'js-cookie'

const TOKEN_KEY = 'vue_admin_template_token'

const USER_KEY = 'vue_admin_template_user'

const ROLE_KEY = 'vue_admin_template_role'

module.exports = {
    getToken: () => {
        return Cookies.get(TOKEN_KEY)
    },
    setToken: (token) => {
        console.debug(token)
        return Cookies.set(TOKEN_KEY, token)
    },
    removeToken: () => {
        return Cookies.remove(TOKEN_KEY)
    },
    getUser: () => {
        return Cookies.get(USER_KEY)
    },
    setUser: (user) => {
        console.debug(user)
        return Cookies.set(USER_KEY, user)
    },
    removeUser: () => {
        return Cookies.remove(USER_KEY)
    },
    setRoles: (roles) => {
        console.debug("roles info saved")
        return Cookies.set(ROLE_KEY, roles)
    },
    getRoles: () => {
        return Cookies.get(ROLE_KEY)
    },
    removeRoles: () => {
        return Cookies.remove(ROLE_KEY)
    }
}
